﻿@{
    ViewBag.Title = "MemberAccPoint";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>       
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
@Html.Partial("~/Views/Modular/BillDetailToolbar.cshtml")
<form id="form1">
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">单据日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width="80px" height ="32px" align="right">
                    积分类型：</td>
                <td width="200px" height ="32px">
                    <input id="datatype" name="datatype" class="mini-combobox" style="width:80px;" showNullItem="false"  
                        allowInput="false" align="left" value ="0" data ="comdataType"/> 
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")
                </td>
                <td width ="70px" align="right">选择会员：</td>
                <td width ="190px">
                    @Html.Partial("~/Views/Modular/LookupMember.cshtml")                      
                </td>
                <td width ="70px" align="right">单据编号：</td>
                <td width ="150px">
                    &nbsp;<input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
        </table>
    </div>
</form>
        <div class="mini-fit" >
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                    borderStyle="border:1;" url="GetMemberAccPoint" showSummaryRow="true" allowCellSelect="true" allowCellEdit="true"
                    showColumnsMenu="true"fitColumns="false" ondrawsummarycell="onDrawSummaryCell" sortMode="client" >
                <div property="columns">
                    <div type="checkcolumn" >选行</div>
                    <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                    <div field="FDate" name="FDate" width="130" headeralign="center" dateFormat="yyyy-MM-dd HH:mm:ss" allowsort="true">日期</div>
                    <div field="FBillNo" name="FBillNo" width="150" headeralign="center" allowsort="true">单据编号</div>
                    <div field="FStockName" name="FStockName" width="100" headeralign="center" allowsort="true">门店名称</div>
                    <div field="FTypeName" name="FTypeName" width="100" headeralign="center" allowsort="true">会员分类</div>
                    <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true">会员卡号</div>
                    <div field="FName" name="FName" width="90" headeralign="center" allowsort="true">会员姓名</div>
                    <div field="FPhone" name="FPhone" width="100" headeralign="center" allowsort="true">联系电话</div>
                    <div field="FPoint" name="FPoint" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">积分</div>
                    <div field="FSetPoint" name="FSetPoint" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">赠送</div>
                    <div field="FRemark" name="FRemark" width="160" headeralign="center" allowsort="true">备注</div>
                </div>
            </div>
        </div>

<input type="hidden" id="type" value="@ViewBag.type" />

<script>
    var comdataType = [{ "id": "0", "text": "全部" },
                       { "id": "1", "text": "加积分" },
                       { "id": "2", "text": "减积分" }]
    var sumFields = "FPoint,FSetPoint";
    mini.parse();

    //通用shown自动调用些方式
    function FormShown() {
        var toDay = new Date();
        mini.getbyName("FDate1").setValue(toDay);
        mini.getbyName("FDate2").setValue(toDay);
        LoadData();
    }

    //加载资料列表
    function LoadData() {
        var form = new mini.Form("#form1");
        form.validate();
        var data = form.getData(true, false);
        var formjson = mini.encode(data);
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + "'FSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'search':'" + formjson + "','FType':'" + mini.getbyName("datatype").getValue() + "'}]";
        var grid = mini.get("datagrid1");//==
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;

    }

    //搜索资料列表
    function search() {
        LoadData();
    }

    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, "会员"+mini.get("datatype").getText()+"明细表");
            }
        });
    }

</script>